#include "mainwindow.h"
#include "ui_mainwindow.h"
#include "plan.h"
#include<QPainter>
#include<QPixmap>
#include<QWidget>
#include<QTimer>
#include<QApplication>
#include<QPushButton>

MainWindow::MainWindow(QWidget *parent)
    : QMainWindow(parent)
    , ui(new Ui::MainWindow)
{
    ui->setupUi(this);

    setWindowTitle("数学绘图");
    setWindowIcon(QIcon(":/image/P_mathematics.svg.png"));
    planpaint=new Plan;
    select=new Select;
    _3D=new ThreeD;

    ui->label->setStyleSheet("image: url(:/image/P_mathematics.svg.png);");
    this->setStyleSheet("background-color: qlineargradient(spread:pad, x1:0, y1:0, x2:1, y2:0, stop:0 rgba(251,102,102, 200), stop:1 rgba(20,196,188, 210));");

    connect(select,&Select::back,this,[=](){
        select->close();
        this->show();
    });
    connect(ui->func1,&QPushButton::clicked,[=](){
        QTimer::singleShot(200,this,[=](){
            planpaint->show();
        });
    });
    connect(ui->func2,&QPushButton::clicked,[=](){
        QTimer::singleShot(200,this,[=](){
            this->hide();
            select->show();
        });
    });
    connect(ui->func3,&QPushButton::clicked,[=]{
        QTimer::singleShot(200,this,[=]{
            _3D->show();
        });
    });
}

MainWindow::~MainWindow()
{
    delete ui;
}
